/**
 * @author LKQ
 * @date 2022/3/3 21:12
 * @description
 */
public class FormalSolution {
    public static void main(String[] args) {

    }
    public boolean checkMove(char[][] board, int rMove, int cMove, char color) {
        // 八个方向
        boolean finish = false;
        int[][] dirs = {{-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}};
        for (int i = 0; i < 8; i++) {
            int ni = dirs[i][0] + rMove, nj =dirs[i][1] + cMove;
            int step = 1;
            while (ni >= 0 && ni < 8 && nj >= 0 && nj < 8 ) {
                if (step == 1) {
                    // 第一个点必须为相反颜色
                    if (board[ni][nj] == '.' || board[ni][nj] == color){
                        break;
                    }
                }else {
                    // 好线段中不应存在空格子
                    if (board[ni][nj] == '.'){
                        break;
                    }
                    // 遍历到好线段的终点，返回 true
                    if (board[ni][nj] == color){
                        finish = true;
                        break;
                    }
                }
                step++;
                ni += dirs[i][0];
                nj += dirs[i][1];
            }
            if(finish) {
                break;
            }
        }
        return finish;
    }
}
